# Wed Apr 06 01:53:58 2022 edit
# 字符编码：UTF-8
# R 版本：R 4.1.3 x64 for window 11
# cgh163email@163.com
# 个人笔记不负责任，拎了个梨🍐🍈
#.rs.restartR()
require(leaflet)
require(leafletCN)

rm(list = ls());gc()

# dt <- read.csv(header = T,'广州赏花全攻略.csv')
dt <- read.csv('https://gitee.com/youmigo/gz_flowers/raw/master/data/%E5%B9%BF%E5%B7%9E%E8%B5%8F%E8%8A%B1%E5%85%A8%E6%94%BB%E7%95%A5.csv',header = T,sep = ',',encoding = 'UTF-8')
# tidyr::unite( dt,"inf",name,Month,add,sep = "\n🍐")[,2] |> #合并列
#   head()

names(dt) <- c('id','name','Month','city','add','lng','lat')
dt$inf <- tidyr::unite( dt,"inf",name,Month,add,sep = "\n🍐")[,2]
dt[seq(1, dim(dt)[1], by = 2) ,] |> as.data.frame() |> DT::datatable(rownames = F)

leaflet() |>
amap() |>
  addPolylines(data = 'https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=440100_full' |> sf::st_read(),
               color = 'green'
               ) |>
addCircleMarkers(
    data = dt,
    lat = ~lat,lng = ~lng,
    popup = ~inf
                   )

